﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web; 
namespace Infrastructure.Web.Services.Mobile
{
    public class MobileService : IMobileService
    {
        public bool IsMobileDevice()
        {
            if (HttpContext.Current.Request.Browser.IsMobileDevice)
            {
                return true; 
            }
            bool result = false; 
            switch (HttpContext.Current.Request.UserAgent)
            {
                case "Nokia5100/2.0 Profile/MIDP-1.0 Configuration/CLDC-1.0":
                    result = true; 
                    break;
                case "Nokia3110c/2.0 (04.91) Profile/MIDP-2.0 Configuration/CLDC-1.1":
                    result = true; 
                    break;
                default:
                    break;
            }
            return result;  
        }


        public bool IsWmlDevice()
        {
            bool result = false;
            switch (HttpContext.Current.Request.UserAgent)
            {
                case "Nokia5100/2.0 Profile/MIDP-1.0 Configuration/CLDC-1.0":
                    result = true;
                    break;
                case "Nokia3110c/2.0 (04.91) Profile/MIDP-2.0 Configuration/CLDC-1.1":
                    result = true;
                    break;
                default:
                    break;
            }
            return result;              
        }
    }
}
